const { contextBridge, ipcRenderer } = require('electron')


contextBridge.exposeInMainWorld("electronApi", {
    nodeVersion: () => process.versions.node,
    chromeVersion: () => process.versions.chrome,
    electronVersion: () => process.versions.electron,
    ping: () => ipcRenderer.invoke('ping'),
    setTitle: title => ipcRenderer.send('set-title', title),
    openFile: () => ipcRenderer.invoke('dialog:openFile'),
    onUpdateCounter: callback => ipcRenderer.on('update-counter', callback),
    onDarkModeToggle: () => ipcRenderer.invoke('dark-mode:toggle'),
    onDarkModeSystem: () => ipcRenderer.invoke('dark-mode:system'),
    onFileDragStart: filePath => ipcRenderer.send('file:dragstart', filePath),
    updateProcessBar: num => ipcRenderer.send('processBar:update', num)
})
